<?php include HEADER; ?>
<link href="<?php echo __URL_BASE ?>css/cart.css" rel="stylesheet" type="text/css">
<style>
table .title {text-align:left;padding:3px;font-weight:bold;}
table .view_tivi td {padding:3px}
</style>
<table border="0" width="100%" cellspacing="1">
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr bgcolor="#F5EFB2" >
    <td style="color:#202020;padding:5px;"><strong>Chi tiết đơn hàng </strong> </td>
	<td align="right" style="padding:5px;"><strong><a href="javascript:print_page()">In hóa đơn</a></strong>&nbsp;|&nbsp; <strong><a href="<?php echo __URL_BASE ?>lich-su-mua-hang.html" style="color:blue" >Quay về</a></strong> </td
  </tr>
  <tr>
    <td colspan="2" style="border:solid #999999 1px"><div id="order_content">
        <table border="0" cellspacing="1" cellpadding="1" width="100%">
          <tbody>
            <tr>
              <td width="50%" align="left" valign="top">&nbsp;</td>
              <td width="50%" align="right" valign="top">&nbsp;</td>
            </tr>
          </tbody>
        </table>
        <div style="margin: 10px 0pt 5px; text-align: center; font-weight: bold; font-size: 24px">HÓA ĐƠN</div>
        <div style="border: 1px solid #000000; padding: 5px">
          <table border="0" cellspacing="0" cellpadding="0" width="100%">
            <tbody>
              <tr>
                <td width="50%" height="30">M&atilde; số đơn h&agrave;ng: <strong><?php echo $hoadon->MaHoaDon ?></strong> </td>
                <td width="50%" align="right">Ng&agrave;y: <strong><?php echo date('d-m-Y',strtotime($hoadon->NgayDatHang)); ?></strong>/T&igrave;nh trạng:<strong><?php echo utility::getOrderStatus($hoadon->TrangThai) ?>  </strong></td>
              </tr>
            </tbody>
          </table>
          <table border="0" cellspacing="1" cellpadding="1" width="100%">
            <tbody>
              <tr>
                <td colspan="2" bgcolor="#F5EFB2" style="padding:3px 0;color:#202020"><strong>Thông tin người nhận hàng</strong></td>
                
              </tr>
              <tr>
                <td class="title" width="180px">Họ tên:</td>
                <td><?php echo $hoadon->TenKH?> </td>
                
              </tr>
			  <tr>
                <td class="title">Email:</td>
                <td><?php echo $hoadon->EmailKH?></td>
                
              </tr>
              <tr>
                <td class="title">Địa chỉ:</td>
                <td><?php echo $hoadon->DiaChiKH?></td>
                
              </tr>
              <tr>
                <td class="title">Điện thoại:</td>
                <td><?php echo $hoadon->DienThoaiKH?></td>
               
              </tr>
              <tr>
                <td class="title">Phương thức thanh toán:</td>
                <td><?php echo $hoadon->MoTa?></td>
               
              </tr>
              <tr>
               
                <td class="title">Thời gian dự kiến nhận hàng:</td>
                <td>Sau ngày đặt hàng 4 - 7 ngày</td>
              </tr>
            </tbody>
          </table>
          <table border="1" class="view_tivi" cellspacing="1" cellpadding="1" width="100%" style="border-collapse: collapse" bordercolor="#808080">
            <tbody>
              <tr bgcolor="#ececec">
                 <td><div align="center"> <strong> Hình ảnh </strong> </div></td>
                <td><div align="center"> <strong> Tên sản phẩm </strong> </div></td>
                <td><div align="center"> <strong> Số lượng </strong> </div></td>
                <td><div align="center"> <strong> Đơn giá<br />(vnd) </strong> </div></td>
                <td><div align="center"> <strong> Thành tiền<br />(vnd) </strong> </div></td>
              </tr>
              <?php
				if(count($chitiethd)>0) :
					foreach($chitiethd as $item) :
						$tiviModel = new tivi();
						$tivi = $tiviModel->getTiviById($item->idTivi);	
				?>
					  <tr>
						 <td align="center"><img src="<?php echo __URL_BASE.'images/'.$tivi->Images ?>" title="<?php echo $tivi->TenTivi ?>" alt="<?php echo $tivi->TenTivi ?>" width="100"> </td>
						<td><?php echo $tivi->TenTivi;?></td>
						<td><div align="right"> <?php echo $item->SoLuong;?> </div></td>
						<td><div align="right"> <?php echo number_format($item->Gia,0,'','.');?> </div></td>
						<td><div align="right"> <?php echo number_format($item->SoLuong*$item->Gia,0,'','.'); ?> </div></td>
					  </tr>
              <?php endforeach; ?>
				  <tr>
					<td colspan="4"><div align="right"> Tổng đơn hàng </div></td>
					<td align="right"><strong><?php echo number_format($hoadon->GiaSP,0,'','.');?></strong></td>
				  </tr>
				  <tr>
					<td colspan="4"><div align="right"> Phí dịch vụ </div></td>
					<td align="right"><strong><?php echo number_format($hoadon->PhiDV,0,'','.');?></strong></td>
				  </tr>
				  <tr>
					<td colspan="4"><div align="right"> Tổng tiền </div></td>
					<td align="right"><strong><?php echo number_format($hoadon->GiaHD,0,'','.');?></strong></td>
				  </tr>
			  <?php endif; ?>
            </tbody>
          </table>
          <table border="0" cellspacing="1" cellpadding="1" width="100%">
            <tbody>
              <tr>
                <td><p><strong>Nh&acirc;n vi&ecirc;n giao 
                    
                    nhận</strong> sẽ li&ecirc;n hệ với qu&iacute; kh&aacute;ch để hẹn lịch giao h&agrave;ng. 
                    
                    Trong trường hợp qu&iacute; kh&aacute;ch đi vắng, vui l&ograve;ng uỷ th&aacute;c cho người 
                    
                    kh&aacute;c nhận h&agrave;ng v&agrave; thanh to&aacute;n tiền thay.<br />
                    <br />
                    <br />
                    <em><strong><font color="#b22222">Ghi  ch&uacute;:</font> Điện thoại cho ch&uacute;ng t&ocirc;i số: </strong></em><strong>08.39492343</strong><em><strong> </strong>nếu bạn cần sự hỗ trợ.</em></p></td>
              </tr>
              <tr>
                <td>Lời chúc: </td>
              </tr>
              <tr>
                <td></td>
              </tr>
            </tbody>
          </table>
        </div>
      </div></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
<?php include FOOTER; ?>
<script>
function print_page(){
	var settings = 'toolbar=yes,scrollbars=yes,location=no,directories=yes,menubar=yes,fullscreen=yes';
	var content = document.getElementById('order_content').innerHTML;

	var docprint=window.open('','',settings);
	docprint.document.open();
	docprint.document.write('<html><head><title><?php echo $hoadon->MaHoaDon ?></title>');
	docprint.document.write('<link href="css/style.css" rel="stylesheet" type="text/css" />');
	docprint.document.write('<link href="css/styleb.css" rel="stylesheet" type="text/css" />');
	docprint.document.write('</head><body style="background:none #FFFFFF" onLoad="self.print()"><center>');
	docprint.document.write(content);
	docprint.document.write('</center></body></html>');
	docprint.document.close();
	docprint.focus();
}
</script>